<script type="text/javascript" src="/js/change.js" language="javascript" ></script>
<?php if($_SESSION['config_template']=='layoutmain_web1') {?>
<div style="clear:both; margin-top:10px; margin-bottom:10px;"></div>
	<div class="content_block">
		<div class="home_head">
			<div class="left_home_head"><span></span></div>
			<div class="center_home_head">
				<h2 style="float: left; width:20%; background:url(../../images/web1/icon_08.gif) no-repeat 100% 0% !important;"><?php echo $title;?></h2>
				<?php if(isset($permission) && $permission=="true") {?>
				<!-- Tạo cây bút chì cho click and change -->
				<div style="width:80%; float:right; height:32px;padding: 8px 0px 9px 0px;" >
					<div id="pageindex">
						<ul class="gallery clearfix" style="float: left;">
							<a href="/lastestproduct/clickchange?iframe=true&width=370&height=275" rel="prettyPhoto[iframe]">
								<img src="/images/Pencil.png" style="width:20px ; height:20px;margin-left:25px; margin-top:0px;"></img>
							</a>
						</ul>
						<ul class="gallery clearfix" style="float: right;font-size:11px;">
							<a href="/index/post?iframe=true&width=800&height=600" rel="prettyPhoto[iframe]" id="askquestion">+ <?php echo $btnpost;?></a>
						</ul>
					</div>
				</div>
				<!-- End - Tạo cây bút chì cho click and change -->
				<?php } ?>
			</div>
			<div class="right_home_head"><span></span></div>
			<div class="clear_both1"><span></span></div>
		</div>

		<div class="content_best">
			<div class="listing-type-grid catalog-listing">
				<ol class="grid-row odd">
				
				<?php foreach ($AllLastestProduct as $product){ $kt=strlen($product['title']);?>
					<li class="item">
						<div class="left_cart_img">
							<p class="product-image">
								<a href="/index/detail?id=<?php echo $product["thing_id"] ?>"> 
									<img src="<?php echo $product['avatar']?>" style="border: 1px solid #E9E9E9; min-width: 96px; min-height: 96px; max-width: 96px; max-height: 96px; border-image: initial;"> 
								</a>
							</p>
							<button onclick="addCart(<?php echo $product["thing_id"] ?>)" class="form-button" type="button" style="min-width:99px !important;">
								<span><?php echo $btnadd ?></span>
							</button>
						</div>
						<div class="right_name_price">
							<h5>
								<a title="<?php echo $product['title'];?>" href="/index/detail?id=<?php echo $product["thing_id"] ?>"><?php if ($kt<=20)  echo $product['title']; else echo substr($product['title'], 0,18)."..";  ?></a>
							</h5>
							<div class="price-box">
								<span id="product-price-51" class="regular-price">
									<span class="price"><?php echo number_format($product['price'])?> VNĐ</span>
								</span>
							</div>
							<p class="add-to">
								<a href="/index/detail?id=<?php echo $product["thing_id"] ?>"><?php echo $btndetail ?></a>
							</p>
						</div>
					</li>
				<?php }?>

				</ol>
			</div>
		</div>
		<div class="bottom_best"><span></span></div>
	</div>
<div style="clear:both; margin-top:10px; margin-bottom:10px;"></div>
<?php } else if($_SESSION['config_template']=='layoutmain_web2') { ?>
	<div class="content_block">
		<div class="content_block_left">
			<div class="product_head">
				<h2> <a style="float:left;width:auto;"> <?php echo $title;?></a>
				<ul class="gallery clearfix" style="float: left;">
					<a href="/lastestproduct/clickchange?iframe=true&width=370&height=275" rel="prettyPhoto[iframe]">
						<img src="/images/Pencil.png" style="width:20px ; height:20px;margin-left:25px;"></img>
					</a>
				</ul>
				<?php if(isset($permission) && $permission=="true") {?>
				<!-- Tạo cây bút chì cho click and change -->
				<div style="float:right;widht:50%;">
					<div id="pageindex">
						
						<ul class="gallery clearfix" style="float: right;">
							<a href="/index/post?iframe=true&width=800&height=600" rel="prettyPhoto[iframe]" id="askquestion">+ <?php echo $btnpost;?></a>
						</ul>
					</div>
				</div></h2>
				<!-- End - Tạo cây bút chì cho click and change -->
				<?php } ?>
			</div>
			<div class="product_body"><!-- Lastest Product -->
				<div id="product-list-table" class="generic-product-grid">
					<div class="group_block">
					<?php foreach ($AllLastestProduct as $product){ $kt=strlen($product['title']);?>
						<div class="Featured_home">
							<h5 class="icon_bg"><a title="<?php echo $product['title'];?>" href="/index/detail?id=<?php echo $product["thing_id"] ?>"><?php if ($kt<=20)  echo $product['title']; else echo substr($product['title'], 0,18)."..";  ?></a></h5>
							<p class="product-image"><a href="/index/detail?id=<?php echo $product["thing_id"] ?>"> <img 
								src="<?php echo $product['avatar']?>" width="132" height="156" > </a></p>
							
							<div class="more_info_01"><span class="new"><span class="price"><?php echo number_format($product['price'])?> VNĐ</span></span>
							</div>
							<div class="group_view">
								<p class="view_view"><a href="/index/detail?id=<?php echo $product["thing_id"] ?>" style="width:auto;"><span ><?php echo $btndetail ?></span></a></p>
								<p class="view_addto">
								<button onclick="addCart(<?php echo $product["thing_id"] ?>)" class="form-button" type="button"><span><?php echo $btnadd ?></span></button>
								</p>
								<div class="clear"></div>
							</div>
							<div class="clear"></div>
						</div>
						<?php }?>
					</div>
					<script type="text/javascript">decorateTable('product-list-table')</script>
				</div>
			</div>
		</div>
	</div>
<?php } else { ?>
 			<p><?php echo $title;?></p>
 				<?php if(isset($permission) && $permission=="true") {?>
				<div class="floatright">
					<div id="pageindex">
						<ul class="gallery clearfix">
							<a href="/index/post?iframe=true&width=800&height=600" rel="prettyPhoto[iframe]" id="askquestion">+ <?php echo $btnpost;?></a>
						</ul>
					</div>
				</div>
				
				<!-- Tạo cây bút chì cho click and change -->
				<ul class="gallery clearfix">
					<a href="/lastestproduct/clickchange?iframe=true&width=370&height=275" rel="prettyPhoto[iframe]">
						<img src="/images/Pencil.png" style="width:20px ; height:20px;margin-left:25px; margin-top:0px;"></img>
					</a>
				</ul>
			
				<!-- End - Tạo cây bút chì cho click and change -->
				<?php } ?>
				<div class="line"><hr></div>
				<!--content rows 1-->
				<div class="c_r_row">
					<!--column 1-->
					<?php $dem=0; $kt=strlen($product['title']);
					foreach ($AllLastestProduct as $product){ $dem++; $kt=strlen($product['title']);?>
					<div style="width:230px;" class="c_r_col">
						<div class="box_p_top">
							<h2><?php if ($kt<=20)  echo $product['title']; else echo substr($product['title'], 0,18)."..";  ?></h2>
						</div>
						<div class="box_p_content">
							<img src="<?php echo $product['avatar']?>" alt="" style="margin-left:45px" class="content_img" width="130" height="130" />
						</div>
						<div class="box_p_bottom">
							<div class="box_p_b_content">
								<p style="font-size:12px;"><?php echo $product['short_description']?></p>
								<p style="margin-left:25px;;margin-top:25px;"><?php echo number_format($product['price'])?> VNĐ</p>
								<div class="button" style="margin-top:10px;">
									<input type="button" name="btnDetails" style="background-image: url('../images/but_details2.png');color:white; border: none;text-align: center;float: right;" value="<?php echo $btndetail ?>" class="btnDetail" onclick="document.location.href='/index/detail?id=<?php echo $product["thing_id"] ?>'"/>
									<input type="button" name="btnAdd" style="background-image: url('../images/but_addtocart2.png');color:white; border: none;text-align: center;float: right;" value="<?php echo $btnadd ?>" class="btnAdd" onclick="addCart(<?php echo $product["thing_id"] ?>)"/>
								</div>
							</div>
						</div>
						</div><!--end column 1-->		
					<?php  
						if($dem==3)
						{
							$dem=0;
							echo"</div><div class='c_r_row' >";
						}
					}?>
																
				</div><!--end first c_r_row-->
				
 <?php } ?>
 <div style="clear: both;"></div>